<?
/**
 * @ignore
 * @package default
 */

// DEBUG:
	define('DEBUG', true);

//Database
	define('MYSQL_SERVER', 	'localhost');
	define('MYSQL_PORT', 	'3306');
	define('MYSQL_DDBB', 	'todoList');
	define('MYSQL_USER', 	'root');
	define('MYSQL_PASS', 	'gepet0');
	
//Login
	define('SESSION_NAME', 'TODO');
	
//Instalation path
	$paths = get_Paths();
	define('SERVER_NAME', $paths['SERVER_NAME']);
	define('APP_DIR', $paths['APP_DIR']);
	define('APP_ROOT', $paths['APP_ROOT']);
	define('UPLOAD_PATH',$paths['UPLOAD_PATH']);
		
//Autoload
	include_once(APP_ROOT."/classes/autoload.php");
	
FB::setEnabled(DEBUG);
if(DEBUG)
	ob_start();

		
/**
 * Get the parameters of the installation path
 * @return array $paths
 */
function get_Paths(){

	$doc_root = apache_getenv('DOCUMENT_ROOT');
	$script_name = apache_getenv('SCRIPT_NAME');

	$tmp1 = explode($doc_root, $script_name);
	$tmp2 = explode("/", $tmp1[0]);
	$dir = $tmp2[1];

	//Variables and Constants of the application
	($doc_root[strlen($doc_root)-1]=='/')?$doc_root=substr($doc_root, 0, strlen($doc_root)-1):null;
	$paths = array();
	$paths['SERVER_NAME'] = $_SERVER['SERVER_NAME'];
	$paths['APP_DIR'] = '/'.$dir;
	$paths['APP_ROOT'] = $doc_root.'/'.$dir;
	$paths['UPLOAD_PATH'] = $doc_root.'/'.$dir.'/archive/';

	return $paths;
}

function getLoginURL(){
	return SERVER_NAME.$_SERVER['PHP_SELF'];
}
?>